{% extends 'starter.html' %}
{% load static %}

{% block username %}
    {{ request.user_obj.username }}
{% endblock %}

{% block content %}
    <h3><a href="{% url 'add_course_record' %}">添加课程记录</a></h3>
    {% load my_tags %}

    <form method="get" class="form-inline pull-right">
        <select name="search_field" class="form-control">
            <option value="customer__name__contains">客户名</option>
            <option value="customer__name__contains">跟进人</option>
        </select>
        <div class="form-group">
            <input type="text" class="form-control" name="search" placeholder="请输入搜索的内容">
        </div>
        <button type="submit" class="btn btn-default">搜索</button>
    </form>
    <form class="form-inline pull-left" method="post">
    {% csrf_token %}
            <select name="create_study_records" class="form-control">
<option value="study_records">批量生成学习记录</option>
        </select>

        <button class="btn btn-warning">go</button>

        <table class="table table-hover table-bordered">
            <thead>
            <tr>
 <td><input type="checkbox">选择</td>
                <td>序号</td>
                <td>姓名</td>
                <td>班级</td>
                <td>节次</td>
                <td>讲师</td>
                <td>本节主题</td>
                <td>本节内容</td>
                <td>操作</td>
            </tr>
            </thead>
            <tbody>
            {% for course_record in course_records %}

                <tr>
                <td><input type="checkbox" value="{{ course_record.name.id }}" name="customer_ids"></td>
                    <td>{{ forloop.counter }}</td>
                    {#                <td>{{ customer.id }}</td>#}
                    <td>{{ course_record.name.name}}</td>
                    <td>{{ course_record.class_grade}}</td>
                    <td>{{ course_record.day_num }}</td>
                    <td>{{ course_record.teacher.username }}</td>
                    <td>{{ course_record.title }}</td>
                    <td>{{ course_record.content }}</td>
{#                    <td><a href="{% url 'edit_customer' customer.id %}"><i class="fa fa-edit"></i></a></td>#}
{#                    <td><a href="{% resolve_url request 'add_follow_customer' customer.id %}"><i class="fa fa-edit"></i></a></td>#}
                    <td><a href="{% resolve_url request 'edit_course_record' course_record.name.id %}"><i class="fa fa-edit"></i></a></td>
                </tr>

            {% endfor %}
            </tbody>
        </table>
        {#    自己封装的分页组件#}
        {#    {{ page_html|safe }}#}
        {#     # mark_safe()后端包裹后，前端就不要safe过滤了，自动识别成标签#}
        {{ page_html }}
    </form>
{% endblock content %}